//
//  PermissionsUtils.m
//  YSSmartHome
//
//  Created by yanghao on 2017/1/12.
//  Copyright © 2017年 yahaong. All rights reserved.
//

#import "PermissionsUtils.h"

@interface PermissionsUtils ()

@end
@implementation PermissionsUtils

+ (BOOL)checkAudioAuthorizationStatus
{
    AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
    if(status == AVAuthorizationStatusAuthorized) {
        // authorized
        return YES;
    } else {
        return NO;
    }

}
+ (BOOL)checkAVAuthorizationStatus {
    AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    return status == AVAuthorizationStatusAuthorized;
}

- (void)showAlert
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"相机权限未开启" message:@"相机权限未开启，请进入系统【设置】>【隐私】>【相机】中打开开关,开启相机功能"
                                                       delegate:nil
                                              cancelButtonTitle:@"取消"
                                              otherButtonTitles:@"立即开启", nil];
    
    [alertView show];
}
@end
